package com.wxn.servlet;
/*
 * Created by wxn
 * 2018/3/20 0:02
 */


import com.wxn.service.QueryService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class AutoReplyServlet extends HttpServlet {
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doGet(req,resp);
	}

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		resp.setContentType("text/html;charset=utf-8");
		String command = req.getParameter("content");
		PrintWriter out = resp.getWriter();
		QueryService queryService = new QueryService();
		out.write(queryService.queryByCommand(command));
		out.flush();
		out.close();
	}
}
